# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-smartencoding
pkgname=('python2-smartencoding' 'python-smartencoding')
_pkgname=smartencoding
pkgver=0.3
pkgrel=9
pkgdesc='Python smart encoding (smart_unicode and other functions).'
arch=('any')
url='https://pypi.org/project/smartencoding/#files'
license=('BSD')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('1416677bdd318fd3c315b7361efbf11f60d02f1855592feea291bab4cf03f420b9322246b329a7a156a0e9420255b968e3773882f03d17cdd8011262d1af0dee')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-smartencoding() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-smartencoding() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

